Skip to content

Fix MDX components type error in blog page#240

Merged
hotlong merged 2 commits intocopilot/restructure-website-docsfrom
copilot/restructure-website-docs-yet-again
Jan 26, 2026
Merged

Fix MDX components type error in blog page#240
hotlong merged 2 commits intocopilot/restructure-website-docsfrom
copilot/restructure-website-docs-yet-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 26, 2026

TypeScript compilation failed on Vercel with FC<AnchorHTMLAttributes> not assignable to NestedMDXComponents | Component<any> when passing fumadocs-ui's defaultMdxComponents directly to MDX.

Changes

  • Spread defaultMdxComponents into new object before passing to MDX component
  • Matches existing pattern in docs page (apps/docs/app/[lang]/docs/[[...slug]]/page.tsx)
// Before
<MDX components={defaultMdxComponents} />

// After
const components = {
  ...defaultMdxComponents,
};

<MDX components={components} />

Type spreading resolves inference issue with React 19 + MDX component types.

Original prompt

22:58:24.915 Running build in Washington, D.C., USA (East) – iad1
22:58:24.916 Build machine configuration: 4 cores, 8 GB
22:58:25.050 Cloning github.com/objectstack-ai/spec (Branch: copilot/restructure-website-docs, Commit: 371774c)
22:58:25.766 Cloning completed: 716.000ms
22:58:26.439 Restored build cache from previous deployment (51PPwgSZs26sUUEodJrxXrqimR7n)
22:58:27.237 Warning: Detected "engines": { "node": ">=18.0.0" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
22:58:27.238 Running "vercel build"
22:58:28.257 Vercel CLI 50.4.10
22:58:29.707 Warning: Detected "engines": { "node": ">=18.0.0" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
22:58:29.771 Detected pnpm-lock.yaml version 9 generated by pnpm@10.x with package.json#packageManager pnpm@10.28.1
22:58:29.806 Installing dependencies...
22:58:32.297 Scope: all 19 workspace projects
22:58:32.523 ../.. | Progress: resolved 1, reused 0, downloaded 0, added 0
22:58:32.632 ../.. | +42 ++++
22:58:33.277 ../.. | Progress: resolved 42, reused 0, downloaded 42, added 42, done
22:58:34.416
22:58:34.489 Done in 2.6s using pnpm v10.28.1
22:58:34.532 Detected Next.js version: 16.1.3
22:58:34.567 Running "pnpm run build"
22:58:35.221
22:58:35.221 > @objectstack/docs@0.1.1 build /vercel/path0/apps/docs
22:58:35.222 > NEXT_PRIVATE_BUILD_WORKER=1 next build
22:58:35.222
22:58:36.016 ⚠ Invalid next.config.mjs options detected:
22:58:36.017 ⚠ Unrecognized key(s) in object: 'turbo' at "experimental"
22:58:36.017 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
22:58:36.554 [MDX] generated files in 109.52051500000016ms
22:58:36.561 ▲ Next.js 16.1.3 (Turbopack)
22:58:36.561 - Experiments (use with caution):
22:58:36.561 ? turbo (invalid experimental key)
22:58:36.562
22:58:36.572 ⚠ The "middleware" file convention is deprecated. Please use "proxy" instead. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy
22:58:36.602 Creating an optimized production build ...
22:59:11.218 ✓ Compiled successfully in 34.2s
22:59:11.224 Running TypeScript ...
22:59:14.898 Failed to compile.
22:59:14.898
22:59:14.899 ./app/[lang]/blog/[[...slug]]/page.tsx:162:16
22:59:14.899 Type error: Type '{ CodeBlockTab: (props: TabsContentProps & RefAttributes) => Element; CodeBlockTabs: ({ ref, ...props }: TabsProps) => Element; ... 17 more ...; CalloutDescription: ({ children, className, ...props }: DetailedHTMLProps<...>) => Element; }' is not assignable to type 'MDXComponents'.
22:59:14.899 Type '{ CodeBlockTab: (props: TabsContentProps & RefAttributes) => Element; CodeBlockTabs: ({ ref, ...props }: TabsProps) => Element; ... 17 more ...; CalloutDescription: ({ children, className, ...props }: DetailedHTMLProps<...>) => Element; }' is not assignable to type 'NestedMDXComponents'.
22:59:14.899 Property 'a' is incompatible with index signature.
22:59:14.899 Type 'FC<AnchorHTMLAttributes>' is not assignable to type 'NestedMDXComponents | Component'.
22:59:14.899 Type 'FunctionComponent<AnchorHTMLAttributes>' is not assignable to type '(props: any) => ReactNode'.
22:59:14.899 Type 'ReactNode | Promise' is not assignable to type 'ReactNode'.
22:59:14.900 Type 'ReactElement<unknown, string | JSXElementConstructor>' is not assignable to type 'ReactNode'.
22:59:14.900 Property 'children' is missing in type 'ReactElement<unknown, string | JSXElementConstructor>' but required in type 'ReactPortal'.
22:59:14.900
22:59:14.900 �[0m �[90m 160 |�[39m �[33m<�[39m�[33m/�[39m�[33mheader�[39m�[33m>�[39m
22:59:14.900 �[90m 161 |�[39m
22:59:14.900 �[31m�[1m>�[22m�[39m�[90m 162 |�[39m �[33m<�[39m�[33mMDX�[39m components�[33m=�[39m{defaultMdxComponents} �[33m/�[39m�[33m>�[39m
22:59:14.900 �[90m |�[39m �[31m�[1m^�[22m�[39m
22:59:14.900 �[90m 163 |�[39m �[33m<�[39m�[33m/�[39m�[33marticle�[39m�[33m>�[39m
22:59:14.900 �[90m 164 |�[39m �[33m<�[39m�[33m/�[39m�[33mmain�[39m�[33m>�[39m
22:59:14.900 �[90m 165 |�[39m �[33m<�[39m�[33m/�[39m�[33mHomeLayout�[39m�[33m>�[39m�[0m
22:59:14.967 Next.js build worker exited with code: 1 and signal: null
22:59:15.056  ELIFECYCLE  Command failed with exit code 1.
22:59:15.104 Error: Command "pnpm run build" exited with 1


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
spec Error Error Jan 26, 2026 3:10pm

Request Review

…ents

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Restructure website documentation Fix MDX components type error in blog page Jan 26, 2026
Copilot AI requested a review from hotlong January 26, 2026 15:13
@hotlong hotlong marked this pull request as ready for review January 26, 2026 15:17
Copilot AI review requested due to automatic review settings January 26, 2026 15:17
@hotlong hotlong merged commit 9cd2682 into copilot/restructure-website-docs Jan 26, 2026
4 of 5 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a TypeScript compilation error that occurred during Vercel deployment when passing defaultMdxComponents directly to the MDX component in the blog page. The error was caused by a type incompatibility between React 19's FC<AnchorHTMLAttributes> and MDX component types.

Changes:

  • Extract defaultMdxComponents into a spread object before passing to the MDX component
  • Aligns blog page implementation with the existing pattern used in the docs page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants